<template>
	<Layout :class="'bg-white p-2'">
		<Row :class="'m-1'">
			<h1>课程申请列表</h1>
		<!-- 	<Col span="4">
				<Button class="m-2" type="error" @click="newUser">新增</Button>
			</Col> -->
			         
		</Row>
		<Layout :class="'bg-white'">
			<Table border :class="'m-1'" :columns="tableInfo.columnInfo" :data="tableInfo.data">
				<template slot-scope="{ row, index }" slot="action">
					<Button type="primary" size="small" style="margin-right: 5px" @click="show(row.requestId)">详细</Button>
<!-- 					<Button type="error" size="small" @click="remove(row.requestId)">删除</Button> -->
				</template>
			</Table>
			<Page :class="'m-2 text-right'" :page-size="tableInfo.pageSize" @on-change="pageSearch" :total="tableInfo.total" />
		</Layout>
	</Layout>
</template>
<script>
	export default {
		data() {
			return {
				storeId: "",
				searchKey: "",
				searchTel: "",
				searchSec: "",
				tableInfo: {
					currentPage: 1,
					total: 0,
					columnInfo: [
						{
							title: "请求编号",
							key: "requestId",
							width: 210
						},
						 
						{
							title: "课程编号",
							key: "courseId",
							width: 420
						},
						{
							title: "请求状态",
							key: "statu",
							width: 420
						} ,
						{
							title: "操作",
							slot: 'action',
							width: 420
						}
					], 
					data: [],
				}
			}
		},
		methods: {
			init: function() {
				this.$data.tableInfo.currentPage = 0;
				this.search();
			},
			newUser: function() {
				this.$router.push({
					name: "course_new"
				});
			},
			show: function(requestId) {
				this.$router.push({
					name: "course_request",
					params: {
						requestId
					}
				});
			},
		  
			search: function() {
			
				this.http.get({
					url: "/store-courses/store-all",
					param: {
						// storeId:this.$data.storeId
						// currentPage: this.$data.tableInfo.currentPage,
						// searchKey: this.$data.searchKey
					}
				}).then(data => {
					
					// this.$data.tableInfo.currentPage = data.current;
					// this.$data.tableInfo.total = data.total;
					// this.$data.tableInfo.pageSize = data.size;
					// console.log(data.records)
					
			 
					this.$data.tableInfo.data = data;
					console.log(this.$data.tableInfo.data);
				});
			},
			pageSearch: function(changedPage) {
				this.$data.tableInfo.currentPage = changedPage;
				this.search();
			}
		},
		created: function() {
			this.init();
		}
		
	}
</script>

<style>
	
</style>
